<?
   /***************************************************************************************************
                    PROGRAM DESCRIPTION :  PROGRAM TO VIEW AND EDIT EXISTING PROGRAMS
                     VARIABLES          :  programs	   	        =programid
                                           mode    	   		    =action selected
  										   msg     	   	        =err msg
                                           programid            =programid
                                           mid         		    =merchant id
                                           url          	    =url
                                           description 		     =pgm description
                                           ip                    =ip blocking time
                     					   status      		     =pgm status
                                           click	           	 =total click amnt
   			  				 				lead	   			 =total lead amnt
                                            sale				 =total sale amnt
                                            saletype   		 	 =saletype(%,$)
                                            ssale	 			 =total subsale amnt
                                            sst        		 	 =sub saletype(%,$)
                                            stclick    		 	 =clickapproval
                                            stlead               =leadapproval
                                            stsale      	     =saleapproval
                                            stmailaffiliate  	 =mailaffiliate
                      						stmailmerchant    	 =mailmerchant
                      						staffiliateapproval  =affiliateapproval
     ************************************************************************************************/


  include "../merchants/transactions.php";
  include_once '../includes/constants.php';
  include_once '../includes/functions.php';
  include_once '../includes/session.php';

//Added by SMA on 14-JUly-2006 for Admin Users
	$userobj = new adminuser();
	$adminUserId = $_SESSION['ADMINUSERID'];
//End Add on 14-July-2006

 /*******************variables**************************************************/
   $programs=trim($_POST['programs']);      //programid
  $mode    =trim($_GET['mode']);           //action selected
  $msg     =trim($_GET['msg']);            //err msg

  /****************************************************************************/
  // echo $programs=$_GET['programs'];

  /********************setting pgmid for first time****************************/
   if(empty($programs))
         {
            $programs=$_GET['programs'];
          }

 $sql="SELECT * from partners_program "; //adding to drop down box
  $result		=mysql_query($sql);

  if(mysql_num_rows($result)==0)
  {
   	echo "<div align='center' class='textred'><b>No Programs Found</b></div>";
    exit;
  }

  $ret			=mysql_query($sql);
  $row			=mysql_fetch_object($ret);
  $programid	=$row->program_id;
   if (empty($programs))
           {
              $programs=$programid;
            }
 /******************************************************************************/



 $pgmid=$programs;
 //$_SESSION['PGMID']=$pgmid;  //assigning to session



 /**************getting values fro m table*************************************/
  $sql  = "SELECT * from partners_joinpgm where joinpgm_programid=$pgmid";
  $sqla = "SELECT * FROM  partners_program where program_id='$pgmid'";
  $sqlb = "SELECT * FROM  partners_pgmstatus where pgmstatus_programid='$pgmid'";
  $sqlc = "SELECT * FROM  partners_secondlevel where secondlevel_programid ='$pgmid'";
  $sqld = "select * FROM  partners_firstlevel where firstlevel_programid='$pgmid'";
  /****************************************************************************/


  /****************from merchants/transaction.php*******************************/
  $total=GetPaymentDetails($sql,'',$default_currency_caption);                 //getting payments (click,sale,lead) values
  $total =explode('~',$total);

  $afftotal=GetTotalAffiliates1($sql);             //getting total affiliates,waiting affiliates,transactions
  $afftotal =explode('~',$afftotal);

  $totallink=GetLinks($pgmid,$MERCHANTID);       //getting advertising links
  $totallink =explode('~',$totallink);
  /****************************************************************************/




                /***************getting program details   from table************/
                  $pgmres=mysql_query($sqla);
                  $stares=mysql_query($sqlb);
                  $secres=mysql_query($sqlc);
                  echo mysql_error();
                  $fstres=mysql_query($sqld);

                  while ($pgmrow=mysql_fetch_object($pgmres))
                   {
                     $mid                           =stripslashes(trim($pgmrow->program_merchantid));
                     $url                           =stripslashes(trim($pgmrow->program_url));
                     $description                   =stripslashes(trim($pgmrow->program_description));
                     $ip                            =stripslashes(trim($pgmrow->program_ipblocking));
                     $saletype                      =stripslashes(trim($pgmrow->program_saletype));
                     $status                        =stripslashes(trim($pgmrow->program_status));
                     $prgm_fee						= trim($pgmrow->program_fee);
                     $prgm_value					= $pgmrow->program_value;
                     $prgm_type						= $pgmrow->program_type;
                     //echo "$url,$description,$ip,$saletype,"."ss";

                   }

                     while ($starow=mysql_fetch_object($stares))
                   {


                       $stclick                       =stripslashes(trim($starow->pgmstatus_clickapproval));
                       $stlead                        =stripslashes(trim($starow->pgmstatus_leadapproval));
                       $stsale                        =stripslashes(trim($starow->pgmstatus_saleapproval));

                       $stmailaffiliate               =stripslashes(trim($starow->pgmstatus_mailaffiliate));
                       $stmailmerchant                =stripslashes(trim($starow->pgmstatus_mailmerchant));
                       $staffiliateapproval           =stripslashes(trim($starow->pgmstatus_affiliateapproval));

                        // echo "$click,$lead,$sale,$mailaffiliate,$mailmerchant,$affiliateapproval";

                     }

                      while ($fstrow=mysql_fetch_object($fstres))
                   {

                       //    firstlevel_salerate

                        $click                    =stripslashes(trim($fstrow->firstlevel_clickrate));
                        $lead                     =stripslashes(trim($fstrow->firstlevel_leadrate));
                        $sale                     =stripslashes(trim($fstrow->firstlevel_salerate));
                        $saletype                 =stripslashes(trim($fstrow->firstlevel_saletype));

                        //echo $click,$sale,$lead,$saletype;

						//modified by SMA 17-JUNE-06
						$impression_rate   =  stripslashes(trim($fstrow->firstlevel_impressionrate));
						$impression_unit   =  stripslashes(trim($fstrow->firstlevel_unitimpression));

						//Modified for Recurring Commission
						$recur_sale			= stripslashes(trim($fstrow->firstlevel_recur_sale));
						$recur_percentage	= stripslashes(trim($fstrow->firstlevel_recur_percentage));
						$recur_period		= stripslashes(trim($fstrow->firstlevel_recur_period));
                        //End modify
	
					//End modify


                   }

                   if(mysql_num_rows($secres)>0)
                   {
                       while ($secrow=mysql_fetch_object($secres))
                   {
                        //$sclick                    =$secrow->secondlevel_clickrate;
                        //$slead                     =$secrow->secondlevel_leadrate;
                        $ssale                       =stripslashes(trim($secrow->secondlevel_salerate));
                        $st                          =stripslashes(trim($secrow->secondlevel_saletype));    /// error
                    }
                   }
                   else
                   {
                    $ssale    ="nill";       //no secondtire offreings
                  }
                 /*************************************************************/


 /****for getting saletype in dropdown box*************************************/
 if ($st=="%")
 {
       $ps1="selected = 'selected'";
       $ds1="";
  }
 else
 {
      $ds1="selected = 'selected'";
      $ps1="";
}
/******************************************************************************/


//////////////////////// program fee and type /////////////////////


   if(($prgm_type == "0")){
   					 $prgm_fee						= $program_fee;
                     $prgm_value					= $program_value;
                     $prgm_type						= $program_type;
   }
///////////////////////////////////////////////////////////////////
  ?>


  <br/>

  <table border='0'  cellpadding="0" cellspacing="0" style="BORDER-COLLAPSE: collapse" width="98%" class="tablewbdr">
  	<tbody>
    	<tr>
        	<td align="center" height="1" ><? echo "<p align='center' > <span class='textred'>$msg</span></p>";?></td>
        </tr>
    </tbody>
  </table>
	<input name="policybtn" type="hidden" value="1" />
	<input name="aprdays" type="hidden" value="0" />
	<input name="PID" type="hidden" />
	<input name="adtype" type="hidden" />
	<input name="adID" type="hidden" />
	<input name="proID" type="hidden" value="98" />
	<table align="center" bgcolor="#000000" border='0' cellpadding="0" cellspacing="0" width="80%">
		<tr>
	   		<td valign="top" width="100%">
		 		<table align="center" bgcolor="#000000" border='0' cellpadding="1" cellspacing="0"  width="100%">
			 	<tbody>
					<tr>
						 <td>
                         	<table bgcolor="#ffffff" border="1" cellpadding="5" cellspacing="0" width="100%" style="border-collapse: collapse"  class="hdbdrf">
							 <tbody>
                                   <tr>
                                   		<td width="100%" bgcolor="#FFFFFF" class="tdhead">
								   		   <form name="Getprogram" method="post" action="index.php?Act=programs&amp;programs=<?=$pgmid?>">
										   <b>Affiliate &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </b>
                                           <select name="programs" onchange="document.Getprogram.submit()">

                                           <?  while($row=mysql_fetch_object($result)){
												   if($programs=="$row->program_id")
														$programName="selected= 'selected'";
												   else
														 $programName="";
										   ?>
                                           	<option <?=$programName?> value="<?=$row->program_id?>">ID:<?=$row->program_id?>..<?=stripslashes($row->program_url)?> </option>
										   <?
										   }
										   ?>
                                           </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		                                   </form>
										</td>
                                        <td width="40%" bgcolor="#ffffff" class="tdhead" align="right">
										<? if($userobj->GetAdminUserLink('Approve/Reject Programs',$adminUserId,3)) { ?> 
                                        	&laquo;&nbsp;<?
											if($status=="active"){
										   ?>
												<a href="program_process.php?pgmstatus=Reject&amp;programs=<?=$pgmid?>">Reject</a>
										   <?
										   }else{
										   ?>
												<a href="program_process.php?pgmstatus=Approve&amp;programs=<?=$pgmid?>">Approve</a>
										   <?
										   }  ?>  &raquo;&nbsp; <?
										}  
										if($userobj->GetAdminUserLink('Change Product Status',$adminUserId,3)) { 
											?>
											<br/>
											&laquo;&nbsp;<a href="index.php?Act=products&amp;pgmid=<?=$pgmid?>">Products</a>
											&raquo;&nbsp;
										<? }  ?>
										</td>
                                   </tr>
								   <tr>
                                    	<td colspan="2" width="100%" height="459">
                                        	<table border='0' cellpadding="2" cellspacing="0" width="100%" style="border-collapse: collapse" bgcolor="#ffffff" class="hdbdr">
											<tbody>
											  <tr>
												  <td bgcolor="#ffffff" height="45" width="50%" class="grid1" align="left">
                                                   	<div align="left"><b>Registered Affiliates&nbsp; -<?=$afftotal[0]?></b></div>
                                                  </td>
                                                  <td bgcolor="#ffffff" height="45" width="50%" class="grid1" align="left">
                                                   	<p align="right"><b><a href="#" onclick="viewLink('<?=$mid?>')">Merchant Details </a> </b></p>
                                                  </td>
                                            </tr>
                                            <tr>
                                                  <td bgcolor="#ffffff" colspan="2" height="45">
                                                    <div align="center"><b>Program Title </b><br/>
                                                      <?=$url?></div><br/>
                                                  </td>
                                            </tr>
                                            <tr>
                                                  <td align="center" bgcolor="#ffffff" colspan="2" height="15" class="grid1">
                                                    <div align="center"><b>Description</b><br/></div>
                                                  </td>
                                            </tr>
                                            <tr>
                                                <td align="center" bgcolor="#ffffff" colspan="2" height="81" class="grid1">
                                                  	<textarea rows="4" name="s1" cols="51"><?=$description?></textarea>
                                                </td>
                                            </tr>
                                            <tr>
                                               <td colspan="2" width="100%">
                                                    <div align="center"><center>
                                                    <table border='0' cellpadding="2" cellspacing="0" width="100%" class="hdbdr">
                                                    <tbody>
														<tr bgcolor="#cccccc">
															   <td align="center" bgcolor="#ffffff" colspan="6"><b>Commissions</b></td>
														</tr>
														<tr bgcolor="#cccccc">
															   <td align="center" bgcolor="#ffffff" colspan="6">&nbsp;</td>
														</tr>
														<tr bgcolor="#cccccc">
															  <td align="center" bgcolor="#ffffff" class="tdhead">
																	  <b>Type</b>
															  </td>
															  <td align="center" bgcolor="#ffffff" class="tdhead"><b>
																	 Commissions</b>
															  </td>
															  <td align="center" bgcolor="#ffffff" class="tdhead"><b>
																	Approval</b>
															  </td>
															  <td align="center" bgcolor="#ffffff" class="tdhead">
																	<b>IP Blocking</b>
															  </td>
														</tr>

														  <!-- Modified by SMA 22-Feb-06  -->
														  <tr>
																<td  bgcolor="#ffffff" align="left"><img
																   alt="" border='0' height="10" src="../images/impression.gif" width="10" /> - Impression</td>
																<td align="center" class="grid3"><?=$currSymbol?><?=$impression_rate?>&nbsp;per&nbsp;<?=$impression_unit?></td>
																<td align="center" class="grid3"><?=$impression_approval?></td>
																<td align="center" class="grid3">&nbsp;</td>
														</tr>
														   <!-- End Modify  -->
														
														<tr>
															  <td bgcolor="#ffffff" class="grid1" align="left">
																   <img border='0' height="10" src="../images/click.gif" width="10" alt="" />
																   - click</td>
															  <td align="center" bgcolor="#ffffff" class="grid1"><?=$currSymbol.$click?></td>
															  <td align="center" bgcolor="#ffffff" class="grid1"><?=$stclick?></td>
															  <td align="center" bgcolor="#ffffff" class="grid1"><?=$ip?>minutes</td>
														</tr>
														<tr>
															  <td bgcolor="#ffffff" class="grid3" align="left">
																  <img border='0' height="10" src="../images/lead.gif" width="10" alt="" /> - lead
															  </td>
															  <td align="center" bgcolor="#ffffff" class="grid3"><?=$currSymbol.$lead?></td>
															  <td align="center" bgcolor="#ffffff" class="grid3"><?=$stlead?></td>
															  <td bgcolor="#ffffff">&nbsp;</td>
													   </tr>
													   <?
													   if($saletype != '%')
													   		$saletype  =  $currSymbol;
													   ?>
													   <tr>
															  <td bgcolor="#ffffff" class="grid1" align="left">
																	  <img border='0' height="10" src="../images/sale.gif" width="10" alt="" /> - sale
															  </td>
															  <td align="center" bgcolor="#ffffff" class="grid1"><?=$saletype?><?=$sale?></td>
															  <td align="center" bgcolor="#ffffff" class="grid1"><?=$stsale?></td>
															  <td align="center" bgcolor="#ffffff" class="grid1">&nbsp;</td>
													   </tr>
													   <tr><td bgcolor="#ffffff" colspan="4">&nbsp;</td></tr>
													   
												<!-- Added by SMA on 20-JUNE-2006 for Recurring Commision -->
														<tr>
															<td  colspan="4" class="tdhead" align="center">
															<b>Recurring Sale Commission</b></td>
														</tr>
														<tr>
															<td colspan="4">
															</td>
														</tr>
														<tr>
															<td colspan="4" align="left">
																<? if($recur_sale == '1') { ?>
																Recur Sale Commission by &nbsp;<?=$recur_percentage?>&nbsp; percentage.&nbsp;&nbsp;&nbsp;&nbsp;Recur Every &nbsp;<?=$recur_period?>&nbsp;Month
																<? } else { echo "Sale Commission is not Recurring"; } ?>
															</td>
														</tr>
														<tr>
															<td colspan="4">
															</td>
														</tr>
												<!-- End Added by SMA on 20-JUNE-2006 -->
													   
													   <tr>
															  <td bgcolor="#ffffff" class="tdhead" colspan="5" >
															  <p align="center"><b>Second Tire Commission</b></p></td>
													   </tr>
													   <tr>
															<td bgcolor="#ffffff" colspan="4"></td>
													   </tr>
													   <tr>
													     <td colspan="6" class="grid1">
														 	 <form name="secondtire" method="post" action="programs_secondtire.php?programs=<?=$pgmid?>">
															 <table width="100%"  border="0" cellspacing="0" cellpadding="0">
															   	<tr>
																	<td width="7%" align="left" bgcolor="#ffffff" class="grid1"><img border='0' height="10" src="../images/sale.gif" width="10" alt="" /> - sale</td>
																	<?
																	  if($ssale =="nill"){
																	 ?>
																	<td width="15%" align="center" bgcolor="#ffffff" class="grid1">
																		<input type="text" name="txtsale" size="10" />
																		<select size="1" name="txtsaletype">
																			 <option value="<?=$currSymbol?>" ><?=$currSymbol?></option>
																			 <option value="%" >%</option>
																		</select>
																	</td>
																	<td width="32%" align="right" bgcolor="#ffffff" class="grid1">
																		<input type="submit" name="mode" size="10" value="Addnew" style="width: 100" />
																	</td>
																		<?
																		}else{
																		?>
																   <td width="15%" align="right" bgcolor="#ffffff" class="grid1">
																		<input type="text" name="txtsale" size="10" value="<?=$ssale?>" />
																		<select size="1" name="txtsaletype">
																			 <option value="$" <?=$ds1?> ><?=$currSymbol?></option>
																			 <option value="%" <?=$ps1?> >%</option>
																		</select>
																   </td>
																   <td width="29%" align="right" bgcolor="#ffffff" class="grid1">
																   <? if($userobj->GetAdminUserLink('Edit Second Tire Commission',$adminUserId,3)) { ?> 
																		<input type="submit" name="mode" size="10" value="Edit"style="width: 100"/> &nbsp;&nbsp;&nbsp;
																		<input type="submit" name="mode" size="10" value="Delete" style="width: 100"/>
																	<? } ?>
																   </td>
																   <? }?>
																  <td width="2%" align="center" bgcolor="#ffffff" class="grid1"></td>
																 </tr>
															 </table>
															 </form>
														 </td>
												      </tr>
												      <tr><td bgcolor="#ffffff" colspan="6"></td></tr>
													<tr>
														<td bgcolor="#ffffff" class="tdhead" colspan="5" ><p align="center"><b>Program Fee</b></p></td>
													</tr>
													<tr>
													  <td bgcolor="#ffffff" colspan="4">&nbsp;</td>
													</tr>
													<tr><!-- ///////////// Set Individual Program Fee //////////////////////////// -->
														<td bgcolor="#ffffff" colspan="4">
															<form name="typeupdate" method="post" action="program_fee.php?programs=<?=$pgmid?>">
															<table width="100%"  border="0" cellspacing="0" cellpadding="0">
															  <tr>
																<td bgcolor="#ffffff" colspan="2" >Program Fee</td>
																<td width="48%"  colspan="1" align="left" bgcolor="#ffffff" >
																	<b><?=$currSymbol?></b>
																<input type="text" name="program" size="6" value="<?=$prgm_fee?>" tabindex="1" />																</td>
															</tr>
															<tr>
																<td bgcolor="#ffffff" colspan="2" >Program Type</td>
																<td  colspan="1" align="left" bgcolor="#ffffff" >
																	<input name="programtype" type="radio" value="1" class="bdrless" <?php echo ($prgm_type==1)? "checked='checked'":''?> onclick="displayDiv()" /><b>One-Time</b></td>
															</tr>
															<tr>
																<td bgcolor="#ffffff" colspan="2" ></td>
																<td colspan="1" align="left" bgcolor="#ffffff" >
																	<input name="programtype" type="radio" value="2" class="bdrless" <?php echo ($prgm_type==2)? "checked='checked'":''?> onclick="displayDiv()" /><b>Recurring</b>
																	<?  list($recur_value,$recur_period) =explode(" ",trim($prgm_value))  ?>
																	<div style="visibility:hidden" id="Recur">																	<b> Recurring Period</b>
																	<input name="recur_value" type="text" value="<?php echo $recur_value?>" size="3" />
																	&nbsp;<select size="1" name="recur_period">
																			<option value="day" <?php echo ($recur_period=="day")? "selected='selected'":''?>>Day(s)</option>
																			<option value="month" <?php echo ($recur_period=="month")? "selected='selected'":''?>>Month(s)</option>
																			<option value="year"  <?php echo ($recur_period=="year")? "selected='selected'":''?>>Year(s)</option>
																		  </select>
																  </div>
															  <script language="javascript" type="text/javascript">
																	  for (i=0; i < document.typeupdate.elements.length; i++){
																		if(document.typeupdate.elements[i].checked == true){
																			if((document.typeupdate.elements[i].value)==2)
																			   document.getElementById("Recur").style.visibility = "visible";
																			else
																				document.getElementById("Recur").style.visibility = "hidden";
																		}
																	  }
																	</script>														      </td>
															   <td width="23%" rowspan="2" align="center" valign="top">
															   <? if($userobj->GetAdminUserLink('Edit Program Fee',$adminUserId,3)) { ?> 
															   	<input type="submit" value="Edit Program Fee" />
															   <? } ?>
															   </td>
															</tr>
															</table>
															</form>
														</td>
													</tr>
													</tbody>
                                                 </table>
                                                 </center></div>
                                               </td>
											</tr>
											<tr><td bgcolor="#ffffff" colspan="2" height="12">&nbsp;</td></tr>
											<tr><td bgcolor="#ffffff" colspan="2" height="12" class="tdhead">
												<p align="center"><b>Email&nbsp; and Program Settings</b></p></td>
											</tr>
											<tr>
												 <td bgcolor="#ffffff" colspan="2" height="12"><div align="center">&nbsp;</div></td>
											</tr>
                                            <tr>
                                                 <td colspan="2" height="85">
                                                     <div align="center"><center>
                                                     <table border='0' cellpadding="2" cellspacing="0" width="100%" class="hdbdr" style="border-collapse: collapse" >
                                                     <tbody>
														<tr>
															<td bgcolor="#ffffff" class="2text" height="19" width="358" align="left">
																 <span class="2text">Send email to affiliate when transaction appears
																 </span><font face="Arial, Helvetica, sans-serif">
																 <span class="2text">: </span></font></td>
															<td bgcolor="#ffffff" class="2text" height="19"  width="242" align="left">
																<div align="left"><span class="2text"><b><?=$stmailaffiliate?></b></span></div>
															</td>
													   </tr>
													   <tr>
															<td bgcolor="#ffffff" class="2text" height="19" width="358" align="left">
																<span class="2text">Send email to me when transaction appears</span></td>
															<td bgcolor="#ffffff" class="2text" height="19" width="242" align="left">
																<span class="2text"><b><?=$stmailmerchant?></b></span></td>
													   </tr>
                                                       <tr>
													  		<td bgcolor="#ffffff" class="2text" height="19"  align="left">Affiliate Approval</td>
													  		<td bgcolor="#ffffff" class="2text" height="19"  align="left">
															<font face="Arial, Helvetica, sans-serif"><span class="2text"><b><?=$staffiliateapproval?></b></span></font>
															</td>
														</tr>
													</tbody>
													</table>
													</center></div>
												</td>
											</tr>
											<tr>
												<td colspan="2" height="57">
													<table border='0' cellpadding="2" cellspacing="0" width="100%"  class="hdbdr" style="border-collapse: collapse">
													<tbody>
													  	<tr>
														  	<td bgcolor="#ffffff" height="15">
															 <div align="center">&nbsp;
															 	<table border='0' cellpadding="0"  width="100%" class="hdbdr" style="border-collapse: collapse" cellspacing="0">
																	<tr>
																		<td width="100%" class="tdhead" align="center" colspan="5">Advertising Links</td>
																	</tr>

																		<?
																		$tot=$totallink[0]+$totallink[1]+$totallink[2]+$totallink[3]+$totallink[4];
																		if($tot==0){
																		?>  <tr>
																		<td height="20" width="20%" align="center" class="textred"  colspan="5" >No Links Added to This Program</td>
																		</tr>
																		<?
																		}else{
																		?>
																		<tr>
																		<td width="20%" align="center" class="grid1" ><a href="index.php?Act=add_text&amp;programid=<?=$pgmid?>">Text - <?=$totallink[1]?></a></td>
																		<td width="20%" align="center"class="grid1"  ><a href="index.php?Act=add_html&amp;programid=<?=$pgmid?>">HTML - <?=$totallink[4]?></a></td>
																		<td width="20%" align="center" class="grid1" ><a href="index.php?Act=add_banner&amp;programid=<?=$pgmid?>">Banner -<?=$totallink[0]?></a></td>
																		<td width="20%" align="center" class="grid1" ><a href="index.php?Act=add_popup&amp;programid=<?=$pgmid?>">Popup - <?=$totallink[2]?></a></td>
																		<td width="20%" align="center" class="grid1" ><a href="index.php?Act=add_flash&amp;programid=<?=$pgmid?>">Flash - <?=$totallink[3]?></a></td>
																		</tr>
																		 <?
																		 }  //// else close
																 		?>

																</table>
																</div>
                                                               </td>
                                                       	</tr>
                                            		</tbody>
                                                    </table>
                                                </td>
                                        	</tr>
									   </tbody>
									   </table>
									 </td>
								  </tr>
								  </tbody>
						   		</table>
                        	</td>
						  </tr>
						  </tbody>
					 </table>
				 </td>
			   </tr>
		 </table><br/>

<br/>

<script language="javascript" type="text/javascript">
<!--

function del_onclick() {
if(confirm("Do you Want to Delete This Program"))
        {
                return true;
        }
        else
        {
        return false;
        }

}


       function help()
                {
                nw = open('secondtire.php','new','height=300>,width=400>,scrollbars=yes');
                nw.focus();
                }



            function viewLink(merchantid)
                {
                    (url="viewprofile_merchant.php?&id="+merchantid);
                   nw = open(url,'new','height=500,width=500,scrollbars=yes');
                   nw.focus();
                }


      	function displayDiv(){
        for (i=0; i < document.typeupdate.elements.length; i++)
         {
           if(document.typeupdate.elements[i].checked == true)
           {
            if((document.typeupdate.elements[i].value)==2)
                   document.getElementById("Recur").style.visibility = "visible";
            else   document.getElementById("Recur").style.visibility = "hidden";
           }
         }

        }
//-->
</script>